<%@page import="web.lbsproject.processaudit.model.TaskExecutionListItem4Web"%>
<%@page import="java.util.LinkedList"%>
<%@page import="web.lbsproject.processaudit.model.WorkRegion4Web"%>
<%@page import="lbsproject.processaudit.model.CheckPoint"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="lbsproject.processaudit.manager.TaskManager" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>巡检项目任务管理</title>
<link href="css/global.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2"></script>
</head>
<body>
	<jsp:include page="WEB-INF/template/header.jsp">
		<jsp:param value="current" name="taskManage"/>
	</jsp:include>
	<div id="container" class="section">
		<div class="main">
			<p class="task-info">
				<strong><%=request.getAttribute("locationName") %></strong><br/>
				<span>当前状态：<%=request.getAttribute("currentState") %></span><span>任务要求：每天巡检</span><br/>
				<span>最近一次检查：<%=request.getAttribute("latestCheckTime") %></span>
			</p>
			<ul class="tab-nav">
				<li class="current"><a href="">当前状况</a></li>
				<%
				String taskExeRecordLink = "";
				String locationID = (String)request.getAttribute("locationID");
				if (locationID != null) {
					taskExeRecordLink = "QueryTaskExecution?location="+locationID+"&type=ALL";
				}
				%>
				&nbsp;&nbsp;<a href="<%=taskExeRecordLink %>">查看执行记录</a>
			</ul>
			<div class="tab-content">
				<table class="table">
					<thead>
						<tr>
							<th width="16%">检查项目</th>
							<th width="16%">所属任务</th>
							<th width="13%">执行人</th>
							<th width="13%">状态</th>
							<th width="26%">描述</th>
							<th width="16%">图片记录</th>
						</tr>
					</thead>
					<tbody>
					<%
					@SuppressWarnings("unchecked")
					List<TaskExecutionListItem4Web> items = 
						(List<TaskExecutionListItem4Web>)request.getAttribute("latestRecordItems");
					if (items != null) {
						for (TaskExecutionListItem4Web item: items) {
					%>
						<tr>
							<td><%=item.getName() %></td>
							<td><%=item.getRelatedTaskName() %></td>
							<td><%=item.getExePresonName() %></td>
							<td><%=item.getState() %></td>
							<td><%=item.getDescription() %></td>
							<%
							if (item.getPhotoUrl() != null) {
							%>
							<td><a href="<%=item.getPhotoUrl() %>"><img src="<%=item.getPhotoUrl() %>" width="20" height="20"></a></td>
							<%
							} else {
							%>
							<td>（无）</td>
							<%
							}
							%>
						</tr>
					<% 
						}
					}
					%>
					</tbody>
				</table>
			</div>
		</div>
		
		<div class="aside">
			<ul class="side-nav">
				<li class="nav-item"><a id="side-nav-1" class="nav-base" href="taskManage.jsp"><b></b><em>实时任务情况</em></a></li>
				<li class="nav-item"><a id="side-nav-2" class="nav-base" href="ShowCheckTaskAssigns"><b></b><em>新增任务</em></a></li>
				<li class="high-light"><a id="side-nav-3" class="nav-base"><b></b><em>任务片区</em><s></s></a>
					<ul id="task-all">
						<%
						@SuppressWarnings("unchecked")
						List<WorkRegion4Web> regions  = (List<WorkRegion4Web>)request.getAttribute("workRegions");
						if (regions==null)  
							regions = new LinkedList<WorkRegion4Web>();
						for (WorkRegion4Web r: regions) {
						%>
						<li><a class="task-base hasmenu" href="#">任务片区-<%=r.getName()%></a>
							<ul>
							<%for (CheckPoint cp: r.getCheckPoints()) { %>
								<li><a href="ListWorkRegions?location=<%=cp.getId()%>"><%=cp.getName()%></a></li>
							<% } %>
							</ul>
						</li>
						<%
						}
						%>
					</ul>
				</li>
			</ul>
		</div>
		<div class="clear"></div>
	</div>
	<jsp:include page="WEB-INF/template/footer.jsp"></jsp:include>
	<script type="text/javascript" src="js/jquery1.4.4.js"></script>
	<script type="text/javascript" src="js/global.js"></script>
	<script type="text/javascript" charset="utf-8">
	$('.tab-nav li').click(function(){
		$(this).addClass('current').siblings().removeClass('current');
		return false;
	});
	</script>
</body>
</html>